Ext.application({
	requires : ['Ext.data.Store','ECAT.lib.Function','ECAT.lib.Contant'],
    name: 'ECAT',
    models: ['Img'],
    controllers: ['FavoriteController','BarController','ItemizeController','AllController'],
    views: ['HomePage','ImgListAll','Menu','TopBar','ButtomBar'],
    launch: function() {
    	Ext.MessageBox.OKCANCEL = [
            {text: '取消', itemId: 'cancel'},
            {text: '确定',     itemId: 'ok',  ui : 'action'}
        ];
        Ext.applyIf(ECAT.lib,Ext.create('ECAT.lib.Function'));
        Ext.applyIf(ECAT.lib,Ext.create('ECAT.lib.Contant'));
       
    	Ext.Viewport.add(Ext.create('ECAT.view.HomePage',{src : ECAT.lib.getIconFileSrc('cover.jpg')}));
        //异步加载其他组件
        setTimeout(function(){
	    	Ext.create('Ext.data.Store',{
	     		id : 'store_fav',
	     		model: 'ECAT.model.Img',
	     		proxy: {
	     			type: 'localstorage',
	     			id  : 'favorite',
	     		    reader: {
	     		        type: 'json'
	     		    }
	     		},
	     		autoLoad: true
	     	});
        	Ext.Viewport.add(Ext.create('ECAT.view.ImgListAll',{id : 'list_img_all'}));
        	Ext.Viewport.add(Ext.create('ECAT.view.TopBar',{id : 'topbar'}));
        	Ext.Viewport.add(Ext.create('ECAT.view.ButtomBar',{id : 'buttombar'}));
        	Ext.Viewport.add(Ext.create('ECAT.view.Menu'));
        },2);
    }
});
